<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width,initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no" />
		<title></title>

		<link rel="stylesheet" type="text/css" href="css/base.min.css" />
		<style>
			html,
			body {
				height: 100%;
				width: 100%;
				background: #fcfcfc;
			}
			
			
			.header{
				padding: 0;
				
			}
			.header ul{
				background: #f2f2f2;
			}
			#footer {
				position: fixed;
				bottom: 0px;
				right: 10px;

				/*z-index: 99999 !important;*/
			}
			
			#footer p {
				/*text-align: center;*/
				color: #636363;
			}
			
		</style>
	</head>

	<body>
		<header class="header header-transparent ">
			<ul class="nav tile nav-justified waves-attach waves-light">
				<li>
					<a>日记</a>
				</li>
			</ul>
		</header>
		<div class="form-group form-group-label">
			<label class="floating-label" for="title">标题</label>
			<input class="form-control" id="title" type="text">
		</div>
		<div class="form-group  form-group-label">
			<label class="floating-label" for="content">内容</label>
			<textarea class="form-control" id="content" rows="23"></textarea>
		</div>
		<footer id="footer">
			<a onclick="update();" class="btn fbtn fbtn-brand waves-attach waves-circle waves-light">
				<img src="img/icon/iconfont-queding.png" class="icon" />
			</a>
		</footer>
	</body>

	<script src="js/appcan/appcan.js"></script>
	<script src="js/appcan/appcan.control.js"></script>
	<script type="text/javascript" src="js/lib/jquery-2.2.1.min.js"></script>
	<script src="js/lib/base.min.js"></script>

	<script>
		var token = appcan.locStorage.getVal('token');
		function update(){
			var data={
				'title':$('#title').val(),
				'content':$('#content').val()
			}
			var url = 'http://192.168.155.1:8080/Match/babyBuddy/public/api/dairy' ;
			$.ajax({
				url: url,
				type: 'POST',
				data:data,
				headers: {
					'Authorization': 'Bearer ' + token
				},
				success: function(d) {
					alert(d.message);
					appcan.frame.close('dairyWrite');
				},
				error: function(e) {
					alert(e);
					console.log(e);
				}
			});
			
		}
	</script>

</html>